<template>
	<view>
		<view class="van_top">
			<van-nav-bar title="协议" left-arrow @click-left="onClickLeft" fixed/>
		</view>
		<view class="content">
			<view class="safe-area" :style="{ height: (statusBarHeight + 46) + 'px' }" style="width: 100%;"></view>
			<view class="inner">
				<rich-text :nodes="content"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
	import { reqAgreement } from '@/apis/user.js'
	import app from "@/App.vue"
	export default {
		data() {
			return {
				statusBarHeight: app.globalData.statusBarHeight,
				activeIndex:0,
				type: '0',
				content:''
			};
		},
		onLoad(p) {
			if (p.type != '') {
				this.type = p.type;
				this.getAgreement();
			}
		},
		methods: {
			onClickLeft() {
				uni.navigateBack();
			},
			async getAgreement() {
				let res = await reqAgreement({ type: this.type });
				if (res.code === 200) {
					this.content = res.data.content;
				}
			}
		},
	}
</script>

<style lang="scss" scoped>
page {
	background: #fff;
}
.inner {
	padding: 0 20rpx 60rpx;
}
</style>